#lang r5rs
(define (product f from to acc)
  (define (product-it f from to it sum)
    (if (> from to)
        sum
        (product-it f (+ from acc) to (+ it 1) (* sum (f from)))))
  (product-it f from to 0 1))
(define (fact n)
  (define (f n) n)
  (product f 1 n 1))
(display (fact 5))
    